package com.slanmao.common.entity;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * <CODE>Response</CODE>
 * 服务响应通用类
 * @author fenrir
 * @Date 18-11-5
 */
@Data
@NoArgsConstructor
public class Response<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    public static final int NO_LOGIN = 401;

    public static final int SUCCESS = 200;

    public static final int FAIL = 500;

    public static final int NO_PERMISSION = 401;

    private String msg = "success";

    private int code = SUCCESS;

    private Integer total;

    private T data;

    public Response(T data) {
        super();
        this.data = data;
    }

    public Response(Throwable e) {
        super();
        this.msg = e.toString();
        this.code = FAIL;
    }
}
